package com.opdar.athena.messages;

import com.opdar.athena.base.Message;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;

/**
 * Created by shiju on 2017/7/6.
 */
public class MigrateMessage  extends Message {

    private String id;
    private String destination;
    private int type;
    private long num;
    private String token;

    public MigrateMessage(byte[] body) {
        DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(body));
        try {
            id = dataInputStream.readUTF();
            destination = dataInputStream.readUTF();
            type = dataInputStream.readInt();
            num = dataInputStream.readLong();
            token = dataInputStream.readUTF();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getNum() {
        return num;
    }

    public void setNum(long num) {
        this.num = num;
    }

    @Override
    public String command() {
        return "Migrate";
    }
}
